# 类
# 方式1
class MyType(type):
    def __new__(cls, *args, **kwargs):
        print(1)
        xx = super().__new__(cls, *args, **kwargs)
        print("创建类：", xx)
        return xx


class Foo(object, metaclass=MyType):
    v1 = 123

    def __init__(self, name):
        self.name = name

    def func(self):
        pass


# 方式2
# Foo = type("Foo", (object,), {"v1": 123, "func": lambda self: 123})

# 对象
foo = Foo('foo')
print(foo.v1)
